#include <iostream>
#include <vector>
using namespace std;

int n, m, w;
vector<int> vi;

bool check(long long x)
{
	vector<long long> st(n, 0);
	long scurr = 0;
	long moves = 0;
	for (long i = 0; i < n; i++)
	{
		scurr -= i - w >= 0 ? st[i - w] : 0;
		if (vi[i] + scurr < x)
		{
			st[i] = x - vi[i] - scurr;
			scurr += st[i];
			moves += st[i];
		}
		if (moves > m)
			return 0;
	}

	return moves <= m;
}

int main()
{
	cin >> n >> m >> w;

	for (int i = 0; i < n; ++i)
	{
		int tmp;
		cin >> tmp;

		vi.push_back(tmp);
	}

	long long high = 1000100000;
	long long low = 1;
	while (low <= high)
	{
		long long mid = (low + high) / 2;

		vector<int> diff;
		int i = 0;
		for (; i < vi.size(); ++i)
		{
			diff.push_back(mid - vi[i]);
			if ((mid - vi[i]) > m)
				break;
		}

		if (i < vi.size())
		{
			high = mid - 1;
			continue;
		}
		
		// check valid
		int pos = 0;
		while (pos < diff.size() && diff[pos] <= 0)
			++pos;

		if (pos < diff.size())
		{
			for (int j = 0; j < m;)
			{
				int val = diff[pos];

				// not enough days left
				if (val > m - j)
					break;

				int end = pos + w;
				for (int k = pos; k < end && k < diff.size(); ++k)
				{
					diff[k] -= val;
				}

				j += val;
				while (pos < diff.size() && diff[pos] <= 0)
					++pos;
				if (pos >= diff.size())
					break;
			}

			if (pos == diff.size()) // good, try higher
			{
				low = mid + 1;
			}
			else
			{
				high = mid - 1;
			}
		}
		else // good
		{		
			low = mid + 1;
		}
	}

	cout << high << endl;
}